%% =========================== [function description] =============================
%Predecessor file ------n1nDpolyRoots.m
%Function ------Multi-dimensional matching point calculation
% Input variables------d0Certain ---- values ----|
% AcCertain---- values----| - possible random variables
% L0Certain---- values----|
% kCertain----- values----|
% coeOfVar----- coefficient of variation matrix
% Collocation--Matrix of collocation points
% groupNumber - the number of groups of collocation points
% index-------- index of collocation points
% outputVariable ------d0--value ----|
% Ac--numeric                    ----|--random variable indexed after matching points
% L0--value                      ----|
% k --- numeric                  ----|
%% =========================== [function body] =============================
function [d0,Ac,L0,k]=iniRanVar(d0Certain,AcCertain,...
    L0Certain,kCertain,coeOfVar,Collocation,groupNumber,index)
variableCell={d0Certain,AcCertain,L0Certain,kCertain};
stable=zeros(groupNumber,1);
j=0;
for i=1:4
    if coeOfVar(i)~=0
        j=j+1;
        inVar=variableCell{i};   
        delta=inVar*coeOfVar(i); % input variable standard deviation
        iinVar=Collocation(:,j)*delta+inVar; %standard normal distribution with input variables to establish relationship
        variableCell{i}=iinVar;
    else 
        variableCell{i}=variableCell{i}+stable;
    end
end
Md0=variableCell{1};
d0=Md0(index);
MAc=variableCell{2};
Ac=MAc(index);
ML0=variableCell{3};
L0=ML0(index);
Mk=variableCell{4};
k=Mk(index);
end
        
       